package com.zjh.document.service.impl;


import com.zjh.document.entity.DTO.FileInfo;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SFTPFileService {
    @Resource
    private SftpService sftpService;

    public List<FileInfo> listFiles(String path) throws Exception {
        return sftpService.listFiles(path);
    }

    public byte[] downloadFile(String filePath) throws Exception {
        return sftpService.downloadFile(filePath);
    }

    public void uploadFile(String path, MultipartFile file) throws Exception {
        sftpService.uploadFile(path + "/" + file.getOriginalFilename(), file.getInputStream());
    }
}